package com.woniuxy.dudugua.service.impl;

import com.woniuxy.dudugua.entity.ProductSku;
import com.woniuxy.dudugua.entity.ProductSkuExample;
import com.woniuxy.dudugua.mapper.ProductSkuMapper;
import com.woniuxy.dudugua.service.ProductSkuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductSkuServiceImpl implements ProductSkuService {

    @Autowired
    private ProductSkuMapper productSkuMapper;
    @Override
    public int insert(ProductSku productSku) {
        int insert = productSkuMapper.insert(productSku);
        return insert;
    }

    @Override
    public List<ProductSku> selectByProductId(Integer productId) {
        ProductSkuExample example = new ProductSkuExample();
        ProductSkuExample.Criteria criteria = example.createCriteria();
        criteria.andProductIdEqualTo(productId);
        return productSkuMapper.selectByExample(example);
    }
}
